﻿
#include "qloggerconsoleappender.hpp"

void QLoggerConsoleAppender::write (const QLoggerEvent &event)
{
    QMutexLocker lock(&mutex);
    streamWrite( (*out_) , event);
}

void QLoggerConsoleAppender::setCodec(QTextCodec *c)
{
    QLoggerAppender::setCodec(c);
    if(out_)
        out_->setCodec(c);
}

QLoggerConsoleAppender::QLoggerConsoleAppender (int level,
                                                FILE *stream,
                                                const QString &format,
                                                const QString& time_format) :
    QLoggerAppender(format, level, time_format),
    stream_(stream)
{
    out_ = QSharedPointer<QTextStream>(new QTextStream(stream_));
}
